<div class="section">
<?php
        $this->widget('AdminManCompMenu', array(
            'comp_id' => $mc->id,
            'comp_title' => $mc->title,
        ));
        ?>

      <? if (!$model->isNewRecord)
        $this->widget('AdminFundsMenu', array(
            'fund_id' => $model->id,
            'fund_title' => $model->title,
        ));
      ?>

<?if(Yii::app()->user->hasFlash('opersuc')):?>
    <div class="messages green" title="Клик, чтобы скрыть" onclick="$(this).fadeOut();" style="cursor:pointer;float:left;clear: both;padding-right: 10px;">
        <span></span>
        <?=Yii::app()->user->getFlash('opersuc');?> 
    </div>
<? endif ?>
<?if(Yii::app()->user->hasFlash('operfail')):?>
    <div class="messages red" title="Клик, чтобы скрыть" onclick="$(this).fadeOut();" style="cursor:pointer;float:left;clear: both;padding-right: 10px;">
        <span></span>
        <?=Yii::app()->user->getFlash('operfail');?> 
    </div>
<? endif ?>
        <div class="box">
            <div class="title">
                <h2><?= $title?></h2>
                <span class="hide"></span>
            </div>
<div class="content forms">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'fundedit',
	'enableAjaxValidation'=>false,
)); ?>
	<div><font color="red"><?= Yii::t('app', 'Обязательные поля') ?>* </font></div>

	<?php echo $form->errorSummary($model); ?>
	<? echo $form->hiddenField($model, "id", array('value' => $fund_id)); ?>
	<? echo $form->hiddenField($model, "management_company_id", array('value' => $_REQUEST['id'])); ?>

	<div class="line">
		<?php echo $form->labelEx($model,'Название фонда'); ?><font color="red">* </font>
		<?php echo $form->textField($model,'title', array('value' => $model->title, 'class'=>"medium") ); ?>
		<?php echo $form->error($model,'title'); ?>
	</div>

	<div class="line">
		<?php echo $form->labelEx($model,'Тип фонда'); ?><font color="red">* </font>
		<?php echo $form->dropDownList($model,'fund_type_id', $fundtypes, array('value' => $model->id)); ?>
		<?php echo $form->error($model,'fund_type_id'); ?>
	</div>

	<div class="line">
		<?php echo $form->labelEx($model,'ID фонда из Yandex'); ?>
		<?php echo $form->textField($model,'global_id', array('value' => $model->global_id, 'class'=>"medium") ); ?>
		<?php echo $form->error($model,'global_id'); ?>
	</div>

	<div class="line">
		<?php echo $form->labelEx($model,'Банк'); ?>
		<?php echo $form->dropDownList($model,'bank_id', $banks, array('value' => $model->id, 'empty'=>'(Выберите банк)')); ?>
		<?php echo $form->error($model,'bank_id'); ?>
	</div>

	<div class="line">
		<?php echo $form->labelEx($model,'Мин.сумма инвестиций'); ?>
		<?php echo $form->textField($model,'depo_min', array('value' => $model->depo_min, 'class'=>"medium") ); ?>
		<?php echo $form->error($model,'depo_min'); ?>
	</div>

	<div class="line">
		<?php echo $form->labelEx($model,'Объект инвестиций'); ?>
		<?php echo $form->textField($model,'invest_object', array('value' => $model->invest_object, 'class'=>"medium") ); ?>
		<?php echo $form->error($model,'invest_object'); ?>
	</div>

	<div class="line">
		<?php echo $form->labelEx($model,'Комиссия за управление'); ?>
		<?php echo $form->textField($model,'fee_managament', array('value' => $model->fee_managament, 'class'=>"medium") ); ?>
		<?php echo $form->error($model,'fee_managament'); ?>
	</div>

	<div class="line">
		<?php echo $form->labelEx($model,'Комиссия с доходности'); ?>
		<?php echo $form->textField($model,'fee_profitability', array('value' => $model->fee_profitability, 'class'=>"medium") ); ?>
		<?php echo $form->error($model,'fee_profitability'); ?>
	</div>

	<div class="line">
		<?php echo $form->labelEx($model,'Описание'); ?>
		<?php echo $form->textField($model,'descriptions', array('value' => $model->descriptions, 'class'=>"medium") ); ?>
		<?php echo $form->error($model,'descriptions'); ?>
	</div>

	<b>Прикрепленных файлов: </b>
	<? if (count($fund_files) > 0) echo count($fund_files);
	   else echo '<i>нет</i>'; ?>

	<div class="line">
		<?php echo CHtml::link(
            $model->isNewRecord ? Yii::t('app', 'Создать') : Yii::t('app', 'Сохранить'),
            '#', 
            array('class'=>"button green", 'style'=>"opacity: 1;", 'onclick' => '$("#fundedit").submit();')); ?>
	    <button type="submit" onclick="window.location.replace('http://<?=$_SERVER['HTTP_HOST']?>/admin.php/mancompanies/edit/id/<?=$_REQUEST['id']?>/funds');return false; " class="red small"><span>Отмена</span></button>
	</div>


<?php $this->endWidget(); ?>

</div><!-- form -->
</div>